from launch import LaunchDescription
from launch_ros.actions import Node
# ---|封装终端指令相关类
# from launch.actions import ExecuteProcess
# from launch.substitutions import FindExecutable
# ---|参数声明与获取
# from launch.actions import DeclareLaunchArgument
# from launch.substitutions import LaunchConfiguration
# ---|文件包含相关
# from launch.actions import IncludeLaunchDescription
# from launch.launch_description_sources import PythonLaunchDescriptionSource
# ---|分组相关
# from launch_ros.actions import PushRosNamespace
# from launch.actions import GroupAction
# ---|事件相关
# from launch.event_handlers import OnProcessStart, OnProcessExit
# from launch.actions import ExecuteProcess, RegisterEventHandler,LogInfo
# ---|获取功能包下 share 目录路径
# from ament_index_python.packages import get_package_share_directory

def generate_launch_description():
    driver = Node(package="ros_driver_imu",executable="ros_imuDriver",name="driver")
    wheel = Node(package="ros_to_stm32",executable="lis",name="wheel")
    arm = Node(package="ros_to_stm32_arm",executable="lis",name="arm")
    camera_1 = Node(package="camera_dispaly",executable="cpp_camera_1",name="camera_1")
    camera_2 = Node(package="camera_dispaly",executable="cpp_camera_2",name="camera_2")
    ahrs_driver=Node(
                    package="fdilink_ahrs",
                    executable="ahrs_driver_node",
                    parameters=[{'if_debug_': False,
                        'serial_port_':'/dev/fdilink_ahrs',
                        'serial_baud_':921600,
                        'imu_topic':'/imu',
                        'imu_frame_id_':'gyro_link',
                        'mag_pose_2d_topic':'/mag_pose_2d',
                        'Magnetic_topic':'/magnetic',
                        'Euler_angles_topic':'/euler_angles',
                        'gps_topic':'/gps/fix',
                        'twist_topic':'/system_speed',
                        'NED_odom_topic':'/NED_odometry',
                        'device_type_':1}],
                    output="screen"
                    )
    imu_talker = Node(package="fdilink_ahrs",executable="imu_tf_node",name="imu_talker")
    weigh_sensor = Node(package="weigh_sensor",executable="weigh_talker",name="weigh_sensor")

    # return LaunchDescription([wheel,arm,camera_1,camera_2,ahrs_driver,imu_talker,weigh_sensor,driver])
    return LaunchDescription([ahrs_driver,imu_talker])
